#include "myhead.h"
#define N 10
struct seqlist // 定义结构体
{
    int ar[N];
};

void CLEAN(int ar[N]) // 清空结构体的函数
{
    bzero(ar, N);
}

void SAME(struct seqlist *code1, struct seqlist *code2, int br[]) // 进行并集
{
    int len_1 = strlen(code1);
    int len_2 = strlen(code2);

    for (int i = 0; i < len_1; i++)
    {
        for (int j = i; j < len_2; j++)
        {
            if (code1->ar[i] == code2->ar[j])
            {
                br[i] = code1->ar[i];
                break;
            }
        }
    }

    // 打印ar并集数组
    int len_3 = strlen(br);
    for (int k = 0; k < len_3; k++)
    {
        printf("%d", br[k]);
    }
}

int main()
{
    struct seqlist *code1 = malloc(sizeof(struct seqlist));
    struct seqlist *code2 = malloc(sizeof(struct seqlist));
    int br[N * 2];

    CLEAN(code1->ar);
    CLEAN(code2->ar);
    CLEAN(br);

    struct seqlist *code1 = {12, 45, 4, 89, 13};
    struct seqlist *code2 = {1, 12, 7, 45, 96, 78, 53};

    SAME(code1, code2, br);

    return 0;
}